import { genId } from 'src/utils/clent-tool'

export interface WorkbenchStateInterface {
  // 事件
  events: {
    id: number, // 事件 ID
    type: number, // 时间类型 eg. 1.待办提醒 2.应用日志 3. ...
    title?: string, // 事件标题
    content?: string, // 事件内容
    // 事件附加数据
    data?: Record<string, unknown>,
    // 数据信息
    createdAt?: Date, // 创建时间
    updatedAt?: Date, // 更新时间
  }[],
  // 配置
  options: {
    autoPlay: boolean,
    backgroundId: string | null,
    backgrounds: {
      id: string,
      url?: string,
      color?: string
    }[],
  },
}

const defaultBackgroundImageId = genId('BK')
export const defaultWorkbenchOptions = () => ({
  autoPlay: false,
  backgroundId: null,
  backgrounds: [
    {
      id: defaultBackgroundImageId,
      url: 'https://assets-1301845716.cos.ap-nanjing.myqcloud.com/quasar.jpg'
    },
    {
      id: genId('BK'),
      url: 'https://assets-1301845716.cos.ap-nanjing.myqcloud.com/background.jpg'
    },
    {
      id: genId('BK'),
      url: 'https://assets-1301845716.cos.ap-nanjing.myqcloud.com/above-the-forest-wallpaper-for-1920x1080-63-1168.jpg'
    },
    {
      id: genId('BK'),
      url: 'https://assets-1301845716.cos.ap-nanjing.myqcloud.com/lake-prags-italy-wallpaper-for-1920x1080-63-1053.jpg'
    }
  ]
})

function state (): WorkbenchStateInterface {
  return {
    events: [],
    options: defaultWorkbenchOptions()
  }
}

export default state
